package cn.colins.consumer.service;

import cn.colins.api.TestService;
import cn.colins.consumer.filter.MyDubboFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.validation.constraints.NotNull;

/**
 * @Description
 * @Author czl
 * @Version V1.0.0
 * @Since 1.0
 * @Date 2023/5/9
 */
public class MyTestService implements TestService {

    private final static Logger log= LoggerFactory.getLogger(MyTestService.class);

    private TestService testService;

    public MyTestService(TestService testService){
        this.testService=testService;
    }


    @Override
    public String test(String message) {
        // 此代码在客户端执行, 你可以在客户端做ThreadLocal本地缓存，或预先验证参数是否合法，等等
        log.info("存根测试...");
        try {
            return testService.test(message);
        } catch (Exception e) {
            // 你可以容错，可以做任何AOP拦截事项
            return "容错数据";
        }
    }
}
